package problem5;

import java.util.*;

public class ArrayListTools {
    public static ArrayList<Integer> arrayToArrayList(int[] arr){
        ArrayList<Integer> a =new ArrayList<>();
   //     Integer[] arrayList = new Integer[arr.length];
        for(int e : arr){
            a.add(e);
        }
        return a;
    }

    public static int getMax(ArrayList<Integer> list){
        int maxium = Integer.MIN_VALUE;
        for(Integer e : list) {
            if(maxium < e){
                maxium = e;
            }
        }
        return maxium;
    }
    public static int getMin(ArrayList<Integer> list){
        int minium = Integer.MAX_VALUE;
        for(Integer e : list) {
            if(minium > e){
                minium = e;
            }
        }
        return minium;
    }
    public static int getSum(ArrayList<Integer> list){
        int sum = 0;
        for(Integer e : list){
            sum += e;
        }
        return sum;
    }
    public static double getAvg(ArrayList<Integer> list){
        return getSum(list) / (list.size()*1.0);
    }
    public static void sort(ArrayList<Integer> list){
        Collections.sort(list);
    }
}
